<template>
	<custom-page :float="true" title="登录" background-color="transparent" nav-background-color="transparent" borderBottomColor="transparent">
		<template #page>
			<view class="page-content">
				<view class="title">请选择您的身份</view>
				<view class="tips">您好，欢迎进入助叫约球平台</view>
				
				<view class="player-layout" @click="playerClick">
					<image :src="asserts.ic_player_default2"></image>
					<view class="right">
						<view>我是玩家</view>
						<text>随时找助教约球玩球</text>
					</view>
				</view>
				<view class="assistant-layout" @click="assistantClick" v-if="isShowInfo">
					<image :src="asserts.ic_logo" style="background: #01CBFF;"></image>
					<view class="right">
						<view>我是助教</view>
						<text>申请成为助教，拿提成</text>
					</view>
				</view>
			</view>
		</template>
	</custom-page>
</template>

<script>
	import {
		storageUserType
	} from '../../global/config.js'
	export default {
		data() {
			return {
				isShowInfo: true,
			}
		},
		onLoad() {
			//获取系统配置
			this.requestCenter.getSystemConfig().then(res => {
				this.isShowInfo = res.formSupport
			})
		},
		methods: {
			
			
			//玩家
			playerClick(){
				uni.setStorageSync(storageUserType, "1")		//用户类型 1 - 普通用户 2 - 助教用户
				uni.reLaunch({
					url: '/pages/index/index'
				})
			},
			
			//助教
			assistantClick(){
				this.requestCenter.getAssistantDetailToken().then(res => {
					uni.setStorageSync(storageUserType, "2")		//用户类型 1 - 普通用户 2 - 助教用户
					if(!res.businessHoursStart || !res.businessHoursEnd){
						uni.navigateTo({
							url: '/pages/assistant-personal-info/assistant-personal-info'
						})
					}else{
						uni.reLaunch({
							url: '/pages/index/index'
						})
					}
				}).catch(error => {
					uni.navigateTo({
						url: '/pages/assistant-certification/assistant-certification'
					})
				})
				

				
			}
		}
	}
</script>

<style scoped lang="less">
	.page-content{
		width: 100%;
		height: 100%;
		display: flex;
		flex-direction: column;
		padding: 0 56rpx;
		box-sizing: border-box;
		background: linear-gradient(180deg, #F5FFFE 0%, #F9F8FD 100%);
	}
	.title{
		font-size: 56rpx;
		color: #021624;
		margin-top: 260rpx;
		line-height: 48rpx;
	}
	.tips{
		font-size: 26rpx;
		color: #585F70;
		margin-top: 20rpx;
		margin-bottom: 112rpx;
	}
	.player-layout,
	.assistant-layout{
		width: 100%;
		height: 180rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		margin-bottom: 56rpx;
		display: flex;
		flex-direction: row;
		align-items: center;
		image{
			width: 112rpx;
			height: 112rpx;
			border-radius: 50%;
			margin-left: 48rpx;
			margin-right: 36rpx;
		}
		.right{
			flex: 1;
			display: flex;
			flex-direction: column;
			view{
				font-size: 36rpx;
				color: #021624;
				line-height: 48rpx;
			}
			text{
				font-size: 28rpx;
				color: #585F70;
				line-height: 48rpx;
				margin-top: 4rpx;
			}
		}
		
	}
	.player-layout{
		background: linear-gradient( 90deg, #FDDBEF 0%, #FDD8CB 100%);
	}
	.assistant-layout{
		background: linear-gradient( 90deg, #CAFAF8 0%, #C6EAFD 100%);
	}

</style>
